\begin{frame}[fragile]{Life Demo}
\begin{center}
\begin{tabular}{c c c}
\begin{tabular}{|c|c|c|c|}
\hline1& & & \\
\hline & &\alert{2}& \\
\hline & & & \\
\hline\alert{2}& & & \\
\hline
\end{tabular}  & \pause
\begin{tabular}{|c|}\hline\textbf{player}\\ \hline id\\ \hline 1 \\ 2\\ \hline \end{tabular} &
\begin{tabular}{|c|c|c|}\hline \multicolumn{3}{|c|}{\textbf{board}} \\ \hline x & y & id\\ 1 & 1 & 1\\1 & 4 & 2\\3 & 2 & 2 \\ \hline \end{tabular} \\
\end{tabular}
\end{center}
\pause
{\small
create table player (  id int primary key );\\
create table board (\\
  int x,\\
  int y,\\
  int id,\\
  primary key x,y,\\
  foreign key(id) references player(id)) ;
}
\end{frame}

\begin{frame}[fragile]{Life Demo}

{\small

\begin {verbatim}
create view nowPlaying(id) as
  select p.id
  from player p
  where exists (select b.id from board b where b.id=p.id);

create view checked(id) as
 select p.id
 from player p
 where exists (select n.id from nowPlaying n where n.id = p.id) and
   not exists (select b1.id from board b1
     where b1.id = p.id and
       not exists
         (select b2.id from board b2
         (b2.x = b1.x or b2.y = b1.y) and (b1.id <> b2.id)));
\end{verbatim}}
\end{frame}
